﻿using System.Collections;
using System.Xml;

namespace LD.Host.Mes
{
    public class MesByHYFSK
    {
        public static bool Post(string url, string interFace, Hashtable table)
        {
            string data = Newtonsoft.Json.JsonConvert.SerializeObject(table);
            Log4.Info($"【MES过账】请求:url:{url}\\{interFace},参数:{data}");

            XmlDocument result = WebServiceCaller.QuerySoapWebService(url,
                                                                      interFace,
                                                                      table);
            Log4.Info("【MES过账】返回:" + result.InnerText);

            if (result.InnerText == null)
            {
                Log4.Info("【MES过账】无返回数据");
                return false;
            }
            else
            {
                if (result.InnerText.IndexOf("OK") >= 0)
                    return true;
                else
                    return false;
            }
        }
        public static bool Check(string url, string interFace, Hashtable table)
        {
            string data = Newtonsoft.Json.JsonConvert.SerializeObject(table);
            Log4.Info($"【MES检查】请求:url:{url}{interFace},参数:{data}");

            XmlDocument result = WebServiceCaller.QuerySoapWebService(url,
                                                                      interFace,
                                                                      table);
            Log4.Info("【MES检查】返回:" + result.InnerText);

            if (result.InnerText == null)
            {
                Log4.Info("【MES检查】无返回数据");
                return false;
            }
            else
            {
                if (result.InnerText.IndexOf("OK") >= 0)
                    return true;
                else
                    return false;
            }
        }
    }
}
